package com.csd.fragment;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.csd.activity.R;
import com.csd.adapter.ApplayAdapter;
import com.csd.bean.Car;
import com.csd.bean.EnterpriseOrder;
/**
 * 待审核
 *
 */
public class AuditingFragment extends Fragment implements OnClickListener{

	private ListView listView;
	private View v;
	private List<EnterpriseOrder> list;
	public static LinearLayout ll_cancle;
	private Button bt_no,bt_yes;
	@Override
	public View onCreateView(LayoutInflater inflater,
			@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		v = inflater.inflate(R.layout.fragment_auditing, null);
		initView();
		return v;
	}
	private void initView() {
		// TODO Auto-generated method stub
		listView = (ListView) v.findViewById(R.id.auditing_list);
		list = new ArrayList<>();
		for (int i = 0; i < 2; i++) {
			EnterpriseOrder order = new EnterpriseOrder();
			Car car = new Car();
			car.setCarBrand("别克凯越");
			order.setOrderId(i+"");
			order.setPurpose("接客户");
			order.setTakeTime("2014/11/06 08:30");
			order.setRetrunTime("2014/11/06 09:00");
			order.setApplyTime("2014-11-06 07:00");
			order.setCar(car);
			list.add(order);
		}
		ApplayAdapter adapter = new ApplayAdapter(getActivity(), list);
		listView.setAdapter(adapter);
		ll_cancle = (LinearLayout) v.findViewById(R.id.ll_cancle);
		bt_no = (Button) v.findViewById(R.id.no);
		bt_yes = (Button) v.findViewById(R.id.yes);
		bt_no.setOnClickListener(this);
		bt_yes.setOnClickListener(this);
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.yes:
			ll_cancle.setVisibility(View.GONE);
			break;
		case R.id.no:
			ll_cancle.setVisibility(View.GONE);
			break;
		default:
			break;
		}
	}
	
	
}
